package com.cs.framework.ui.builder.db;

import javax.sql.DataSource;

import com.cs.framework.ui.builder.AbstractUIBuilder;
import com.cs.framework.ui.dao.UIDefDao;

/**
 * 通过数据库的抽象UI构建
 * 
 * @author hedongzhou
 *
 */
public abstract class AbstractDbUIBuilder extends AbstractUIBuilder {

	/**
	 * 数据源
	 */
	protected DataSource dataSource;

	/**
	 * 处理框架UI定义的dao
	 */
	protected UIDefDao defDao;

	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	public void setDefDao(UIDefDao defDao) {
		this.defDao = defDao;
	}

	/**
	 * 初始化
	 */
	public void init() {
		if (defDao == null) {
			defDao = new UIDefDao(dataSource);
		}
	}

}
